//导入自己的css
require('../css/login.less')
// 跳转
document.querySelector('.jump').onclick =function(){
    location.href ='./register.html'
}
window.onload = function(){
    let tellInp =document.querySelector('#tell')
    let pwdInp =document.querySelector('#pwd')
    let btn =document.querySelector('.btn')
    btn.addEventListener('click',function(){
        if(!(tellInp.value&& pwdInp.value)){
            // alert('请将lue 信息输入完整')
            common.toast(0,'请将信息输入完整')
            return;
        }


        // 请求接口
        let data = {
            account:tellInp.value,
            password:pwdInp.value
        }
        $http.post('/users/login',data,function(res){
            if(res.status ==0){
                // alert('成功')
                common.toast(1,'登陆成功')
                let userId = res.data.user.userId;
                localStorage.setItem('userId',userId)
                location.href='./jogging.html'
            }else{
                // alert(rse.msg)
                common.toast(0,res.msg)
            }
        })
    })
}